//
//  EMCacheMananger.m
//  EasyMoney
//
//  Created by 邓乐 on 2020/1/11.
//  Copyright © 2020 zh. All rights reserved.
//

#import "EMCacheMananger.h"

static EMCacheMananger *__instance = nil;

@interface EMCacheMananger ()
@property (nonatomic, strong) YYCache *cache;
@end

@implementation EMCacheMananger

+ (instancetype)shared
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        __instance = [[EMCacheMananger alloc] init];
    });
    return __instance;
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.cache = [YYCache cacheWithName:@"Common"];
    }
    return self;
}
- (void)updateLocalData:(id)model andModelName:(NSString *)name{
    [self.cache setObject:model forKey:name];
}
- (id)getLocalData:(NSString *)name{
    return [self.cache objectForKey:name];
}

@end
